<template>
	<view class="page">
		<u-navbar :title="title" :auto-back="true">
			<view class="u-nav-slot" slot="right">
				<view class="nav-right" @click="openPopUp">
					<u-icon name="search" size="24" color="#376CB4"></u-icon>
					<u-icon name="list" size="24" style="margin-left: 20rpx;" color="#376CB4"></u-icon>
				</view>
			</view>
		</u-navbar>
		<view class="ll"></view>
		<!-- 搜索列表 -->
		<view class="search-list" >
			<view class="search-empty" v-if="!qkzs_rst">
				<image src="../../static/kong.png" class="empty-img"></image>
			</view>

			<view class="search-list-item" v-for="(item, index) in qkzs_rst" :key="index" >
				<view class="search-list-item-title font-28">
					{{item.columnsname}}
				</view>
				<view class="search-list-item-box-content" v-for="(item1, index1) in item.children" :key="index1" @click="gotoDetail(item1)">
					<image src="../../static/pdf.png" class="search-list-item-img"></image>
					<view class="search-list-item-content">
						<view class="search-list-item-content-t font-28">{{item1.title}}</view>
						<view class="search-list-item-content-b">
							<view class="font-24">{{item1.addtime}}</view>
							<view class="font-24 search-list-item-content-bb">
								<u-icon name="eye" color="#999999" style="margin-right: 10rpx;" size="18"></u-icon>
								<text>{{item1.hits}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<Footer></Footer>
		<u-back-top :scroll-top="scrollTop" bottom="20" icon="arrow-up" right="10"
			:iconStyle="{color:'#2979ff'}"></u-back-top>
		<CommonTk  ref="commonTk"></CommonTk>	
	</view>
</template>

<script>
	import Footer from '@/components/Footer.vue'
	import CommonTk from '@/components/CommonTk.vue'
	import {
		api,
		apiBaseUrl,
		http
	} from '@/config/common.js'
	export default {
		data() {
			return {
				id:'',
				page:1,
				total_page:1,
				qkzs_rst:[],
				
				scrollTop: 0,
				index: 0,
				title: ''
			}
		},
		components: {Footer,CommonTk},
		filters: {},
		mounted() {},
		onLoad(e) {
			this.id = e.id
			this.title = e.str
			this.initList()
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		onShow() {},
		beforeDestroy() {}, 
		onReachBottom() {
			if (this.page < this.total_page) {
				this.page = this.page + 1
				this.qkzs()
			} else {
				console.log('no more')
			}
		},
		methods: {
			openPopUp() {
				this.$refs.commonTk.openShow()
			},
			initList() {
				api.post('api/index/qkmls_list', {bid:this.id,page:this.page}).then(res => {
					let rst = res.data 
					if (rst.code == 1) {
					  let result = rst.data
					  this.total_page = result.last_page 
					  let temp_rst = result.data; 
					  this.qkzs_rst = this.qkzs_rst.concat(temp_rst) 
					} 
				}).catch(err => {})
			},
			gotoDetail(item){
				uni.navigateTo({
					url:'/pages/journal_introduction/detail?id='+item.id
				})
			}
		}
	};
</script>

<style scoped>
	.ll {
		height: 100rpx;
	}

	.search-list-item-title {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #333333;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.search-list-item-content-t {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.search-list-item-content-bb {
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.search-list-item-content-b {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.search-list-item-img {
		width: 102rpx;
		height: 106rpx;
	}

	.search-list-item-content {
		width: 550rpx;
		height: 106rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.search-list-item-box-content {
		width: 690rpx;
		margin: 0 auto;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		border-bottom: 2rpx solid #E5E5E5;
		padding: 30rpx 0;
	}

	.search-list-item {
		width: 690rpx;
		margin: 0 auto;
		padding: 20rpx 0;
	}

	.empty-img {
		width: 364rpx;
		height: 293rpx;
	}

	.search-empty {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		margin-top: 40rpx;
	}

	.search-box {
		width: 690rpx;
		margin: 0 auto;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		margin-top: 30rpx;
	}

	.search-box-input {
		display: flex;
		flex-direction: row;
		align-items: center;
		padding: 0 20rpx;
	}

	.search-box-btn {
		width: 96rpx;
		height: 66rpx;
		background: #376DB5;
		border-radius: 4rpx;
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
	}

	.search-box-input {
		width: 579rpx;
		height: 66rpx;
		background: #FFFFFF;
		border-radius: 4rpx;
	}

	.search-nav-title {
		width: 80%;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.search-nav {
		width: 690rpx;
		margin: 0 auto;
		margin-top: 110rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.search-nav-item {
		display: flex;
		height: 66rpx;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		padding: 0 10rpx;
		background: #FFFFFF;
		border-radius: 4rpx;
	}

	::v-deep .u-navbar__content {
		width: 750rpx;
		height: 88rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 2rpx 14rpx 0rpx rgba(4, 0, 0, 0.14);
	}

	.nav-right {
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.logo {
		width: 306rpx !important;
		height: 55rpx !important;
	}

	page { 
		background-color: #fff;
	} 
</style>